package com.hcr.elecident;

import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import java.util.Timer;
import java.util.TimerTask;

public class WelcomeActivity extends AppCompatActivity {

    public static String myName = "";
    public static String myNum = "";
    public static String myPhoto = "";

    public static final String TEMP_DATA="temp_data";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);

        com.hcr.elecident.ActivityManager.getActivityManager().popActivity(this);

        // 判断是否有数据
//        SharedPreferences pre = getSharedPreferences(TEMP_DATA,MODE_PRIVATE);
//        String name = pre.getString("name",null);  //姓名
//        String phone = pre.getString("phone",null);// 手机号
//        String num = pre.getString("num",null);// 身份证号码
//        String photo = pre.getString("photo",null);//电子头像

        final Intent it = new Intent(this, MainActivity.class);

        Timer timer = new Timer();
        TimerTask task = new TimerTask() {
            @Override
            public void run() {
                startActivity(it);
                finish();
            }
        };
        timer.schedule(task, 1000 * 1);

//        if (name != null || phone != null || num != null || photo != null){
//            // 跳转到6.html
//            final Intent it = new Intent(this, PageActivity.class);
//            it.putExtra("name",name);
//            it.putExtra("num",num);
//            it.putExtra("fileName",photo);
//
//
//            // 全局信息
//            WelcomeActivity.myName = name;
//            WelcomeActivity.myNum = num;
//            WelcomeActivity.myPhoto = photo;
//
//            Timer timer = new Timer();
//            TimerTask task = new TimerTask() {
//                @Override
//                public void run() {
//                    startActivity(it);
//                    finish();
//                }
//            };
//            timer.schedule(task, 1000 * 1);
//
//        } else {
//            final Intent it = new Intent(this, MainActivity.class);
//
//            Timer timer = new Timer();
//            TimerTask task = new TimerTask() {
//                @Override
//                public void run() {
//                    startActivity(it);
//                    finish();
//                }
//            };
//            timer.schedule(task, 1000 * 1);
//        }
    }
}
